﻿<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
    <title>客户产品列表</title>
    <script type="text/javascript" src="/Scripts/Commen.js"></script>
    <script type="text/javascript" src="/Scripts/BD_Customer/BD_Customer_Index.js"></script>
</head>
<body>
    <script type="text/javascript" src="/Scripts/ExtTimeOut.js"></script>
    <script type="text/javascript" src="/Scripts/ExtRequiredFieldPluins.js"></script>
    <script type="text/javascript" src="/Scripts/VType.js"></script>
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <!--列表数据源-->
    <ext:Store ID="CustomerListStore" IDMode="Explicit" runat="server" RemoteSort="true"
        SkipIdForNewRecords="false" UseIdConfirmation="false" SerializationMode="Complex">
        <Proxy>
            <ext:HttpProxy Url="/Customer/CustomerListPaging" />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="FId" Root="data" TotalProperty="total">
                <Fields>
                    <ext:RecordField Name="FId" />
                    <ext:RecordField Name="FNumber" />
                    <ext:RecordField Name="FName" />
                    <ext:RecordField Name="FContactor" />
                    <ext:RecordField Name="FContactPhone" />
                    <ext:RecordField Name="FContactMobile" />
                    <ext:RecordField Name="FContactEmail" />
                    <ext:RecordField Name="FContactAddress" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <BaseParams>
            <ext:Parameter Name="limit" Value="15" Mode="Raw" />
            <ext:Parameter Name="start" Value="0" Mode="Raw" />
            <ext:Parameter Name="fNumber" Value="#{InputQ_FNumber}.getValue()" Mode="Raw" />
            <ext:Parameter Name="fName" Value="#{InputQ_FName}.getValue()" Mode="Raw" />
            <ext:Parameter Name="fContactor" Value="#{InputQ_FContactor}.getValue()" Mode="Raw" />
            <ext:Parameter Name="fContactPhone" Value="#{InputQ_FContactPhone}.getValue()" Mode="Raw" />
            <ext:Parameter Name="fContactMobile" Value="#{InputQ_FContactMobile}.getValue()"
                Mode="Raw" />
            <ext:Parameter Name="fContactEmail" Value="#{InputQ_FContactEmail}.getValue()" Mode="Raw" />
            <ext:Parameter Name="fContactAddress" Value="#{InputQ_FContactAddress}.getValue()"
                Mode="Raw" />
        </BaseParams>
    </ext:Store>
    <!--编辑数据源-->
    <ext:Hidden ID="FIdH" IDMode="Explicit" runat="server" Text="" AutoDataBind="true" />
    <ext:Store ID="CustomerEidtStore" runat="server" AutoLoad="false">
        <Proxy>
            <ext:HttpProxy Url="/Customer/findCustomerById" />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="FId" Root="data" TotalProperty="total">
                <Fields>
                    <ext:RecordField Name="FId" />
                    <ext:RecordField Name="FNumber" />
                    <ext:RecordField Name="FName" />
                    <ext:RecordField Name="FContactor" />
                    <ext:RecordField Name="FContactPhone" />
                    <ext:RecordField Name="FContactMobile" />
                    <ext:RecordField Name="FContactEmail" />
                    <ext:RecordField Name="FContactAddress" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <BaseParams>
            <ext:Parameter Name="fId" Value="#{FIdH}.getValue()" Mode="Raw" />
        </BaseParams>
        <Listeners>
            <BeforeLoad Handler="#{EditFormPanel}.el.mask('正在加载信息...', 'x-mask-loading');" />
            <LoadException Handler="#{EditFormPanel}.el.unmask();" />
            <Load Fn="BD_Customer.Mgr.formStoreLoaded" />
        </Listeners>
    </ext:Store>
    <ext:Viewport ID="CustomerViewport" runat="server" Layout="BorderLayout">
        <Items>
            <ext:FormPanel ID="EditFormPanel" runat="server" Title="客户信息编辑" Region="North" Split="true"
                Height="150" Collapsible="true" Layout="HBoxLayout" Padding="5" AnchorHorizontal="100%"
                LabelWidth="60" Url="/Customer/SaveOrUpadteCustomer">
                <TopBar>
                    <ext:Toolbar ID="TopBar" runat="server">
                        <Items>
                            <ext:ToolbarFill runat="server">
                            </ext:ToolbarFill>
                            <ext:Button ID="Button2" runat="server" Text="新增" Icon="Add">
                                <Listeners>
                                    <Click Handler="#{EditFormPanel}.form.reset();#{FIdH}.setValue(null);" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button1" runat="server" Text="保存" Icon="Disk">
                                <Listeners>
                                    <Click Handler="#{EditFormPanel}.form.submit({waitMsg:'正在保存...', params:{fId:#{FIdH}.getValue()},success:BD_Customer.Mgr.successHandler , failure:BD_Customer.Mgr.failureHandler});" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <Items>
                    <ext:Panel runat="server" Border="false" Header="false" Layout="FormLayout" LabelAlign="Right"
                        LabelWidth="70" Padding="5">
                        <Items>
                            
                            <ext:TextField ID="Input_FName" Name="fName" DataIndex="FName" runat="server" FieldLabel="客户名称"
                                AllowBlank="false" BlankText="客户名称不能为空" Width="150" />
                            <ext:TextField ID="Input_FContactor" Name="fContactor" DataIndex="FContactor" runat="server"
                                FieldLabel="联系人" AllowBlank="true" BlankText="联系人不能为空" Width="150" />
                        </Items>
                    </ext:Panel>
                    <ext:Panel ID="Panel2" runat="server" Border="false" Layout="FormLayout" LabelAlign="Right"
                        LabelWidth="70">
                        <Items>
                            <ext:TextField ID="Input_FContactPhone" Name="fContactPhone" DataIndex="FContactPhone"
                                runat="server" FieldLabel="手机号码" AllowBlank="true" BlankText="手机号码不能为空" Width="200"
                                Vtype="mobilephone" />
                            <ext:TextField ID="Input_FContactMobile" Name="fContactMobile" DataIndex="FContactMobile"
                                runat="server" FieldLabel="电话号码" AllowBlank="true" BlankText="电话号码不能为空" Width="200"
                                Vtype="phone" />
                            <ext:TextField ID="Input_FContactEmail" Name="fContactEmail" DataIndex="FContactEmail"
                                runat="server" FieldLabel="电子邮箱" AllowBlank="true" Width="200" Vtype="email" />
                        </Items>
                    </ext:Panel>
                    <ext:Panel ID="Panel3" runat="server" Border="false" Header="false" Layout="FormLayout"
                        LabelAlign="Right" LabelWidth="70">
                        <Items>
                            <ext:TextField ID="Input_FContactAddress" Name="fContactAddress" DataIndex="FContactAddress"
                                runat="server" FieldLabel="客户地址" AllowBlank="true" BlankText="客户地址不能为空" Width="450" />
                        </Items>
                    </ext:Panel>
                </Items>
            </ext:FormPanel>
            <ext:FormPanel ID="SearchFormPanel" runat="server" Title="筛选条件" Region="West" Width="250"
                Split="true" Collapsible="true" Layout="FormLayout" Padding="5" LabelWidth="50">
                <Items>
                    <ext:TextField ID="InputQ_FNumber" runat="server" FieldLabel="编号" AnchorHorizontal="100%"
                        Width="180" />
                    <ext:TextField ID="InputQ_FName" runat="server" FieldLabel="姓名" AnchorHorizontal="100%"
                        Width="180" />
                    <ext:TextField ID="InputQ_FContactor" runat="server" FieldLabel="联系人" AnchorHorizontal="100%"
                        Width="180" />
                    <ext:TextField ID="InputQ_FContactPhone" runat="server" FieldLabel="电话" AnchorHorizontal="100%"
                        Width="180" />
                    <ext:TextField ID="InputQ_FContactMobile" runat="server" FieldLabel="手机" AnchorHorizontal="100%"
                        Width="180" />
                    <ext:TextField ID="InputQ_FContactEmail" runat="server" FieldLabel="邮箱" AnchorHorizontal="100%"
                        Width="180" />
                    <ext:TextField ID="InputQ_FContactAddress" runat="server" FieldLabel="地址" AnchorHorizontal="100%"
                        Width="180" />
                </Items>
                <Buttons>
                    <ext:Button ID="Button5" runat="server" Text="搜索" Icon="Accept">
                        <Listeners>
                            <Click Fn="BD_Customer.Mgr.searchList" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="Button6" runat="server" Text="清空" Icon="Cancel">
                        <Listeners>
                            <Click Fn="BD_Customer.Mgr.resetSearchFrom" />
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:FormPanel>
            <ext:Panel ID="Panel4" runat="server" Region="Center" Layout="AccordionLayout" Split="true"
                Header="false">
                <Items>
                    <ext:GridPanel ID="CustomertGrid" runat="server" Border="false" StoreID="CustomerListStore"
                        StripeRows="true" TrackMouseOver="true" ClicksToEdit="0" Region="Center">
                        <ColumnModel ID="ColumnModel1" runat="server" DefaultSortable="false">
                            <Columns>
                                <ext:Column ColumnID="ID" DataIndex="FId" Header="ID" Hidden="true">
                                </ext:Column>
                                <ext:Column ColumnID="Number" DataIndex="FNumber" Header="编号" Width="140">
                                </ext:Column>
                                <ext:Column ColumnID="Name" DataIndex="FName" Header="姓名">
                                </ext:Column>
                                <ext:Column ColumnID="Contactor" DataIndex="FContactor" Header="联系人">
                                </ext:Column>
                                <ext:Column ColumnID="ContactPhone" DataIndex="FContactPhone" Header="电话">
                                </ext:Column>
                                <ext:Column ColumnID="FContactMobile" DataIndex="FContactMobile" Header="手机">
                                </ext:Column>
                                <ext:Column ColumnID="FContactEmail" DataIndex="FContactEmail" Header="邮箱">
                                </ext:Column>
                                <ext:Column ColumnID="FContactAddress" DataIndex="FContactAddress" Header="地址">
                                </ext:Column>
                                <ext:CommandColumn Width="80" Hideable="false">
                                    <Commands>
                                        <ext:GridCommand CommandName="Edit" Icon="ApplicationFormEdit" Text="修改">
                                        </ext:GridCommand>
                                    </Commands>
                                </ext:CommandColumn>
                                
                                <ext:CommandColumn Width="60" Hideable="false">
                                    <Commands>
                                        <ext:GridCommand CommandName="Delete" Icon="Cross" Text="删除">
                                        </ext:GridCommand>
                                    </Commands>
                                </ext:CommandColumn>
                               
                            </Columns>
                        </ColumnModel>
                        <BottomBar>
                            <ext:PagingToolbar ID="PagingToolbar1" runat="server" StoreID="CustomerListStore"
                                PageSize="15" />
                        </BottomBar>
                        <Listeners>
                            <Command Fn="BD_Customer.Mgr.commandHandler" />
                        </Listeners>
                        <LoadMask ShowMask="true" />
                    </ext:GridPanel>
                </Items>
            </ext:Panel>
        </Items>
    </ext:Viewport>
</body>
</html>
